<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="com.wanmait.hotelManage.vo.Room"%>
<%@page import="com.wanmait.hotelManage.vo.RoomType"%>
    <%
    String path=request.getContextPath();
    List<RoomType>roomTypelists=(List<RoomType>)request.getAttribute("roomtypes");
    Integer id=(Integer)request.getAttribute("id");
    Boolean idss=(Boolean)request.getAttribute("idss");
    RoomType roomtype=(RoomType)request.getAttribute("roomtype");
    if(roomTypelists!=null){
    %>
<jsp:include page="/manage/inc/header.jsp"></jsp:include>
<jsp:include page="/manage/inc/menu.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">&gt;</span><a href="<%=path%>/manage/RoomServlet?action=list">客房管理</a><span class="crumb-step">&gt;</span><span>新增作品</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="<%=path %>/manage/RoomServlet?action=update&id=<%=id %> " method="post" id="myform" name="myform" >
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <th width="120"><i class="require-red">*</i>房间类型：</th>
                            <td>
                                <select name="colId" id="catid" class="required">
                               <%--  <%
                                if(roomtype!=null){
                                %>
                                <option   class="a" ><%=roomtype.getTitle() %></option>--%>
                                    <%
                                   
                                    	
                                    	for(int i=0;i<roomTypelists.size();i++){
                                    		RoomType roomtypes=roomTypelists.get(i);
                                    		%>                  		
                                    		<option class="a" value="<%=roomtypes.getId()%>"><%=roomtypes.getTitle() %></option>
                                    		<%
                                    }
                                    	/* } */
                                    %>
                                    
                                </select>
                            </td>
                            </tr>
                            <tr>
                            <th width="120"><i class="require-red">*</i>房间状态：</th>
                            <td>
                                <select name="check" id="check" class="required">
                                    		<option class="b">空闲</option>
                                    		<option class="c">入住</option>
                                </select>
                            </td>
                            </tr>
                       <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                                    <input class="btn btn6" id="resetbutton" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
                <%
    }
                %>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
<jsp:include page="/manage/inc/footer.jsp"></jsp:include>
<script>
<%-- $(function(){
if(roomtype!=null){
$(".a").prop("selected","<%=roomtype.getTitle()%>");
}
}) --%>
$(function(){
	$(".a").each(function(){
		var b=$(this).val();
		 if(<%=roomtype.getId()%>==b){
				$(this).prop("selected",true);
		}
	})
	var flag=<%=idss%>;
	if(flag==false){
		$(".b").prop("selected",true);
	}
	if(flag==true){
		$(".c").prop("selected",true);
	}
		 
})
</script>
<script>
$("#resetbutton").click(function(){
	window.location.href="<%=path%>/manage/RoomServlet?action=list";
})
</script>